Purpose
The calculateTimeDiff task calculates the difference between two timestamps and returns the result between them as a duration.
Potential Use Case
You could use the calculateTimeDiff task if you need to determine the remaining time (or elapsed time) between a recorded timestamp and today's date.
Properties
| Incoming | Type | Description | 
|---|---|---|
| firstTime | Object | Required. The time to subtract from using the secondTimeparameter. | 
| secondTime | Object | Required. The time that is subtracted from the firstTimeparameter. | 
| Outgoing | Type | Description | 
|---|---|---|
| timeDiff | Object | The difference between the two time values expressed as a duration in multiple units. For example: "milliseconds": -2592000000"seconds": -2592000"minutes": -43200"hours": -720"days": -30"months": -0.9856465225158627"years": -0.08213721020965523 | 
Examples
Example 1
In this IAP example:
- The - firstTimeproperty is provided by the output of- addDuration, another another task located elsewhere in the workflow. The reference variable provided by the other task is- newtime.
- The - secondTimeproperty is provided by the output of another task (referred to here as- getTime) and the reference variable is- time.
- For this example, let's say the incoming value of - secondTimeis less than the incoming value of- firstTime. Consequently, the outgoing- timeDiffvalue will be a positive time reference such as: There are 'X' number of days between now and the future date. 
Example 2
In this IAP example:
- The - firstTimeproperty is provided by the output of- getTime, another another task located elsewhere in the workflow. The reference variable provided by the other task is- time.
- The - secondTimeproperty is provided by the output of another task (referred to here as- addDuration) and the reference variable is- newTime.
- For this example, let's say the incoming value of - secondTimeis greater than the incoming value of- firstTime. Consequently, the outgoing- timeDiffvalue will be a negative time reference such as: The elapsed time since the- firstTimedeadline was surpassed by- secondTime.